# coding=utf-8
import yaml

def read_yaml(file_path):
    with open(file_path, "r") as f:
        # k = []
        # for k in f.items():#将字典转化为二维数组
        #     k.append(k)
        return yaml.safe_load(f)

def write_yaml(file_path,data):
    # 打开并写入 YAML 文件
    with open(file_path, 'w') as file:
        yaml.dump(data, file)
    return "写入成功"

# data = read_yaml("1.yaml")
# print(data)

# data = {
#     'name': 'Alice',
#     'age': 30,
#     'city': 'Wonderland'
# }
# print(write_yaml("1.yaml", data))

